package com.example.common.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.example.common.livedata.SingleLiveEvent
import com.example.common.state.BaseUiState
import com.kunminx.architecture.domain.message.MutableResult

open class BaseViewModel <S : BaseUiState>: ViewModel() {

    //子类提供公共的LiveData
    protected  val _mLiveData : MutableLiveData<S> = MutableLiveData<S>()

    //使用SingleLiveEvent防止数据倒灌
    protected val _mliveEvent :SingleLiveEvent<S> = SingleLiveEvent()

    //使用第三方unpeekLivedata
    protected val unPeekLiveData =MutableResult<S>()

    //提供公共的可访问的LiveData
    val mLiveData : LiveData<S> = unPeekLiveData






}